;; Demonstration of apply and map functions

;; Using apply to sum a list of numbers
(display "Sum of (1 2 3 4 5): ")
(display (apply + '(1 2 3 4 5)))
(newline)

;; Using apply with additional arguments
(display "Sum of 10, 20, and (1 2 3): ")
(display (apply + 10 20 '(1 2 3)))
(newline)

;; Using map to square each element in a list
(display "Squares of (1 2 3 4): ")
(display (map (lambda (x) (* x x)) '(1 2 3 4)))
(newline)

;; Using map with multiple lists
(display "Element-wise sum of (1 2 3) and (4 5 6): ")
(display (map + '(1 2 3) '(4 5 6)))
(newline)

;; Using map to extract the first element of each sublist
(display "First elements of ((1 2) (3 4) (5 6)): ")
(display (map car '((1 2) (3 4) (5 6))))
(newline)